module WelcomeHelper
  def show_listing_title
    if controller.action_name == "admin"
      title = content_tag(:h2, ("Listing articles" + content_tag(:span, "(Edit Mode)")))
    else
      title = content_tag(:h2, "Listing articles")
    end
  end
  
  def link_to_article_and_show_category_name(article)
    controller_name = controller.controller_name
    if controller_name == "iphone"
      "#{link_to article.title, :controller => :iphone, :action => :show, :id => article} [#{article.category.name}]"      
    else
      action = controller.action_name == "admin" ? :edit : :show
      "#{link_to article.title, :controller => :articles, :action => action, :id => article} [#{article.category.name}]"      
    end
  end  
  
  def show_content(params, article, &block)
    tmp = with_output_buffer(&block)
    class_name = (!params[:category].nil? && article.stickied) ? "article_list stickied" : "article_list"
    content_tag(:div, tmp, :class => class_name)
  end
end
